system.htmlHTMLudog^πùΔ§πùΔ§ÅÅ' Monkeybread Realbasic plugin - Documentation - System

MBS Plugin Documentation

This is the documentation for the Realbasic Plugins from Monkeybreadsoftware.de. You find these plugins and the newest version of this document at http://www.monkeybreadsoftware.de/realbasic inside the plugins section.

This help was last updated on Freitag, 6. September 2002 and covers 2136 items: 126 classes, 2 controls and 583 global functions.

The list of the themes Global methods by category Global methods by name The list of the classes The list of the controls

class System

class, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Extends Realbasic's System class.

ADBAvailable as boolean

method, System Sa, 27. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Returns allways false. Windows: Returns allways false.
Function: Returns whether ADB is available on that Mac.
Example:
if system.ADBAvailable then
' you have ADB
end if
Notes: I use that function to see if people need an ADB or an USB dongle for their Mac.

ADBCount as integer

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Returns allways 0. Windows: Returns allways 0.
Function: Returns the number of ADB devices connected to the Mac.
Example: msgbox str(system.adbcount)+" ADB devices are connected to this Mac."

BatteryCount as Integer

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: not tested. Windows: Returns allways 0.
Function: Returns the number of installed batteries on your Mac.
Example: msgbox "You have "+str(system.BatteryCount)+" batteries in your computer."

BatteryInstalled as Integer

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: not tested. Windows: Returns allways 0.
Function: Returns the number of installed batteries on your Mac.
Example: msgbox "You have "+str(system.BatteryInstalled)+" batteries in your computer."

ClassicBoxRunning as boolean

method, System Mi, 1. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: -> false. Windows: -> false.
Function: Returns true if the application is running inside the Mac OS Classic compatibility environment inside Mac OS X.
Example:
if ClassicBoxRunning then
msgbox "This application must be run on Mac OS 9 only."
end if

Computername as string

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Returns the name of the computer.
Example: msgbox "Hi, I'm "+system.computername+"."

Delay(sec as double)

method, System Mi, 1. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Stopps the application for the given time.
Example: delay 1.5 // wait one and a half seconds
Notes:
Mac OS Classic:
The application takes 100% CPU Power till time has gone.

Mac OS X and Windows:
The application takes 0% CPU Power till time has gone.

FirstBattery as battery

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: returns allways nil.
Function: Returns a battery object for the first battery.
Example:
dim b as battery
b=system.FirstBattery

GetCPUTemperature as integer

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Returns allways 0. Windows: Returns allways 0.
Function: Returns the CPU temperature.
Example:
dim temp as integer
dim temp1 as integer
dim temp2 as integer

temp=system.CPUTemperature

temp1=bitwiseand(temp,&HFFFF) 'lower 16 bits
temp2=temp\&H10000 'higher 16 bits

if temp2=0 and temp1=0 then
me.text="unknown"
elseif temp2=0 then
me.text=str(temp1)+"°"
else
me.text=str(temp1)+"° and "+str(temp1)+"°"
end if
Notes: If you have two CPUs you'll find the temperature in the high part.

LogicalRAM as integer

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Returns the size of the logical installed memory.
Example: msgBox format(system.LogicalRAM/1024/1024,"0")+" MB of RAM built in."
Notes:
On Mac OS X and Windows allways 2 Gigabytes.
On Mac OS Classic the virtual memory used or the physical memory. The virtual memory includes the memory used for filemapping. You'll have some MB more than you might exspect, because the Mac OS ROM needs for example 3 MB and this is added. So 320 MB physical RAM can lead into 330 MB logical RAM. 320 MB physical plus 1 MB minimum for virtual memory plus 3 MB for the Mac ROM and around 6 MB for some application file mapping.

MACAddress as string

method, Network Fr, 30. Aug 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: -> "".
Function: Returns the hardware ethernet address of the first ethernet card.
Example: msgBox system.MACAddress
Notes:
It returns a string with 6 bytes.
Works now with MBS Plugin 2.6 for Mac OS Classic, Carbon inside Classic and Mac OS X, but may not work for a Classic application running on Mac OS X. And may fail on some machines if no OpenTransport is running.

On Windows and Mac OS X you can have multiple ethernet cards and you should use a command line tool with the shell class to find what you need.

For example on Windows:

ipconfig /all

or on Mac OS X:

ifconfig -a

MPServiceAvailable as Boolean

method, System Sa, 27. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Returns allways false. Windows: Returns allways false.
Function: Returns whether Mac OS Classic Software is installed to handle multiple CPUs.
Example:
if system.MPServiceAvailable then
msgBox "Multiprocessing services are available"
end if#
Notes: Without this software a second CPU won't be seen by the other functions.

OSName as string

method, System So, 28. Apr 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Returns a string to display which OS Version you have.
Example:
msgBox system.osname
' may show: Mac OS X
Notes:
Return values possible:
Win32s
Windows
Windows NT
Mac OS
Mac OS X

OSVersionStr as string

method, System So, 28. Apr 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Returns a string to display which OS Version you have.
Example:
msgBox system.osversionStr
' may show: Mac OS X 10.1.2
Notes:
GetOSVersionStr returns the version string of the OS.
Some Possible values:
"System 7.5.3",
"MacOS 8",
"MacOS 9.1",
"MacOS X",
"Windows 4.0" or
"Windows NT 3.5".
Note that Windows 4.0 is Windows 95 and Windows 4.1 is Windows 98.

PhysicalRAM as integer

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Returns the size of the physical installed memory.
Example: msgBox format(system.physicalRAM/1024/1024,"0")+" MB of RAM built in."
Notes: On Windows some hundred KBs less for DOS.

RunningOnCarbonX as boolean

method, System Mi, 1. Mai 2002
Mac OS Classic: ->false Mac OS Carbon: Works Windows: ->false
Function: Returns true if we are running Carbon on Mac OS X.
Example:
if RunningOnCarbonX then
' do Stuff for Mac OS X only
end if

SecondBattery as battery

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: returns allways nil.
Function: Returns a battery object for the second battery.
Example:
dim b as battery
b=system.SecondBattery

TotalBattery as battery

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: returns allways nil.
Function: Returns a battery object for the values of all installed batteries.
Example:
dim b as battery
b=system.TotalBattery

USBAttribute as integer

method, System So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Returns allways 0.
Function: Returns the USB Attributes.
Example:
if bitwiseand(system.USBAttribute,2)<>0 then
msgBox "USB Isochronous features available"
end if

USBAvailable as boolean

method, System Sa, 27. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Returns allways false.
Function: Returns whether USB is available on that Mac.
Example:
if system.USBAvailable then
' you have USB
end if
Notes: I use that function to see if people need an ADB or an USB dongle for their Mac.

Username as string

method, System Do, 1. Aug 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Returns the name of the current user.
Example: msgbox "Welcome "+system.username+"!"
Notes:
Mac OS X 10.0.2 and later: Works
Mac OS 9: Works
Windows: Works

Code for Multiple User is build in, but I can't test it.

This is tried on Mac OS:
1. AppleEvent to FileSharing.
2. Mac OS X Username function.
3. Mulitple User Username (Mac OS 9)
4. System username from system resource.

GetDoubleClickInterval as integer

global method, System So, 23. Jun 2002
Mac OS Classic: Works Mac OS Carbon: Works Windows: Works
Function: Returns the time in ticks which makes two clicks to one double click.
Example:
Function MouseUp(X As Integer, Y As Integer)
dim currentClickTicks as Integer
currentClickTicks = ticks

if (currentClickTicks - lastClickTicks) <= DoubleClickTime then
if abs(x - lastClickX) <= 5 and abs (y - lastClickY) <= 5 then
DoubleClick //Fire new Doubleclick event
return
end
end

lastClickTicks = currentClickTicks
lastClickX = x
lastClickY = y
MouseUp
End Function
Notes: Time returned in ticks. One tick is 1/60 of a second.

Contact

Written 2002 by Christian Schmitz. Feel free to ask or report mistakes to realbasic@macsw.de.
Thanks.

This resource fork intentionally left blank ˇˇ